﻿CREATE VIEW dbo.VIEW_SEARCH_PAYMENT_IN
AS
SELECT        dbo.PAYMENT_IN.ID, dbo.PAYMENT_IN.NUMBER, dbo.PAYMENT_IN.DATE, dbo.PAYMENT_IN.SUM_RUB, 
                         dbo.NSI_ORGANIZATION.SHORT_NAME AS NSI_ORGANIZATION_NAME, dbo.NSI_TYPE_OF_ACTIVITY.NAME AS NSI_TYPE_OF_ACTIVITY_NAME, 
                         dbo.CONTRACT.NUMBER AS CONTRACT_NUMBER, dbo.PAYMENT_IN.PID, dbo.PAYMENT_IN.NSI_ORGANIZATION_ID
FROM            dbo.PAYMENT_IN LEFT OUTER JOIN
                         dbo.CONTRACT ON dbo.PAYMENT_IN.PID = dbo.CONTRACT.PID LEFT OUTER JOIN
                         dbo.NSI_TYPE_OF_ACTIVITY ON dbo.CONTRACT.NSI_TYPE_OF_ACTIVITY_ID = dbo.NSI_TYPE_OF_ACTIVITY.ID LEFT OUTER JOIN
                         dbo.NSI_ORGANIZATION ON dbo.PAYMENT_IN.NSI_ORGANIZATION_ID = dbo.NSI_ORGANIZATION.ID